<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/includes/common-import.jsp"%>
<%@ taglib uri="/page" prefix="p"%>
<%@ taglib uri="/data" prefix="d"%>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<head>
	<meta charset="utf-8" />
	<title>${systemName}</title>
	<meta content="width=device-width, initial-scale=1.0" name="viewport" />
	<meta content="" name="description" />
	<meta content="" name="author" />
	<%@ include file="/WEB-INF/includes/common-component-edit.jsp"%>
</head>
<body class="page-header-fixed">
	<%@ include file="/WEB-INF/includes/header.jsp"%>
	<div class="page-container row-fluid">
		<%@ include file="/WEB-INF/includes/leftMenu.jsp"%>
		<div class="page-content">
			<div class="container-fluid">
				<div class="row-fluid">
					<div class="span12">
						<h3 class="page-title">
							教师评价体系管理
						</h3>
					</div>
				</div>
				<!-- END PAGE HEADER-->
				<!-- BEGIN PAGE CONTENT-->
				<div class="row-fluid">

					<div class="span12">

						<div class="portlet box blue" id="form_wizard_1">
							<div class="portlet-title">
								<div class="caption">
									<i class="icon-reorder"></i> 教师评价体系 -》第三步
								</div>
							</div>
							<div class="portlet-body form">
								<form id="inputForm" class="form-horizontal" action="${basePath}teacherExamSetting/${action}" method="post" >
									<div class="alert alert-error ${empty ERROR ?'hide':'' }">
										<button class="close" data-dismiss="alert"></button>
										<span>${ERROR }</span>
									</div>
									<div class="alert alert-success ${empty MESSAGE ?'hide':'' }">
										<button class="close" data-dismiss="alert"></button>
										<span>${MESSAGE }</span>
									</div>
									<div style="margin-left: 10px; font-size: 14px;">
										<p>
											编码： ${setting.code}
										</p>
										<p>
											评价体系名称： ${setting.name}
										</p>
										<p>
											描述： ${setting.content}
										</p>
										<p>
											考核期间： <d:view tableName="examDate" field="startDate" primaryValue="${setting.examDateId }"/> ~ <d:view tableName="examDate" field="endDate" primaryValue="${setting.examDateId }"/>
											（<d:view tableName="examDate" field="description" primaryValue="${setting.examDateId }"/>）
										</p>

									</div>
									<div class="control-group">
										<table class="table table-striped table-bordered table-hover" id="updateTable">
											<thead>
											<tr>
												<th width="15%">参评教师</th>
												<th width="15%">评价类别</th>
												<th width="15%">类别权重</th>
												<th width="10%">评分人员选择</th>
												<th>评分项目</th>
												<th>评分项目分值</th>
											</tr>
											</thead>
											<tbody>
											<c:forEach items="${list}" var="list" varStatus="status">
												<tr class="odd gradeX">
													<td>
														<d:view tableName="teacher" field="teacher_name" primaryValue="${list.teacherId}"/>
													</td>
													<td>
														<input type="hidden" id="${list.teacherId}"/>
														<d:view tableName="kind" field="kind_name" primaryValue="${list.kindId }"/>
													</td>
													<td>
														<input type="hidden" name="weightIds" value="${list.code}@${list.teacherId}@${list.kindId}"/>
														<input id="weight" type="text" name="weight" value="${list.weight}"  style="width: 100px;"/>
													</td>
													<td>
														<c:if test="${hasResult == 0}">
															<a class="btn green" href="#" onclick="selectUser(${list.code},${list.teacherId},${list.kindId});">
																选择 <i class="icon-plus"></i>
															</a>
														</c:if>
													</td>
													<td>
														<d:view tableName="exam_item" field="item_name" primaryValue="${list.examItemId }"/>
													</td>
													<td>
														<input type="hidden" name="itemScoreIds" value="${list.code}@${list.teacherId}@${list.kindId}@${list.examItemId}"/>
														<input type="text" name="score" value="${list.score}"  style="width: 100px;"/>
													</td>
												</tr>
											</c:forEach>
											</tbody>
										</table>
									</div>
									<div class="form-actions clearfix">
										<a class="btn blue" href="${basePath}teacherExamSetting/reloadSecondStep/${code}">上一步</a>
										&nbsp;&nbsp;
										<c:choose>
											<c:when test="${hasResult > 0}">
												<a class="btn blue" href="${basePath}teacherExamSetting">完成</a>
											</c:when>
											<c:otherwise>
												<button class="btn blue" type="button" onclick="finishSystem();"><i class="icon-ok"></i>完成</button>
											</c:otherwise>
										</c:choose>

									</div>
								</form>
							</div>

						</div>

					</div>

				</div>
			</div>
		</div>
	</div>
	<script src="${resPath}media/js/app.js"></script>   
	<script>

		jQuery.fn.rowspan = function(colIdx) { //封装的一个JQuery小插件
			return this.each(function(){
				var that;
				$('tr', this).each(function(row) {
					$('td:eq('+colIdx+')', this).filter(':visible').each(function(col) {
						if (that!=null && $(this).html() == $(that).html()) {
							rowspan = $(that).attr("rowSpan");
							if (rowspan == undefined) {
								$(that).attr("rowSpan",1);
								rowspan = $(that).attr("rowSpan"); }
							rowspan = Number(rowspan)+1;
							$(that).attr("rowSpan",rowspan);
							$(this).hide();
						} else {
							that = this;
						}
					});
				});
			});
		}

		$(function() {
			$("#updateTable").rowspan(0);//传入的参数是对应的列数从0开始，哪一列有相同的内容就输入对应的列数值
			$("#updateTable").rowspan(1);
			$("#updateTable").rowspan(2);
			$("#updateTable").rowspan(3);
		});

		function selectUser(code,teacherId,kindId){
			$.dialog({
				id:'subWin1',
				title:'查看评分人',
				width:750,
				height:550,
				fixed: true,
				lock:true,
				content:"url:${basePath }teacherExamSetting/selectUser/"+code+"/"+teacherId+"/"+kindId+"/1"
			});
		}

		function finishSystem(){
			$("#inputForm").attr("action", "${basePath}teacherExamSetting/finishSystem/${code}");
			$("#inputForm").submit();
		}
	</script>
</body>
</html>
